﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.CApMlmManipulator
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands;

internal class CApMlmManipulator
{
  private double MANIPULATOR_LENGTH = 600.0;
  private double TEXT_OFFSET_FROM_AXIS = 50.0;
  private ITxLocatableObject _item;
  private TxManipulatorCreationData _data;

  public TxManipulatorCreationData Data => this._data;

  public CApMlmManipulator(ITxLocatableObject item)
  {
    this._item = item;
    this.CreateManipulatorData();
  }

  private void CreateManipulatorData()
  {
    this.MANIPULATOR_LENGTH = (double) TxApplication.ViewersManager.GraphicViewer.ViewRectangle.Width / 20.0;
    this.TEXT_OFFSET_FROM_AXIS = this.MANIPULATOR_LENGTH / 12.0;
    if (this._item == null)
      throw new NullReferenceException("The locatable object is null.");
    this._data = new TxManipulatorCreationData();
    ((TxObjectCreationData) this._data).Name = ((ITxObject) this._item).Name + "Manipulator";
    ((TxLocatableObjectCreationData) this._data).AbsoluteLocation = this._item.AbsoluteLocation;
    TxManipulatorLineElementData manipulatorLineElementData1 = new TxManipulatorLineElementData(new TxTransformation(), new TxVector(0.0, 0.0, 0.0), new TxVector(this.MANIPULATOR_LENGTH, 0.0, 0.0));
    ((TxManipulatorElementData) manipulatorLineElementData1).Color = TxColor.TxColorRed;
    ((TxManipulatorElementData) manipulatorLineElementData1).Pickable = true;
    ((TxManipulatorElementData) manipulatorLineElementData1).AlwaysOnTop = true;
    ((TxManipulatorElementData) manipulatorLineElementData1).Unzoomable = true;
    TxManipulatorLineElementData manipulatorLineElementData2 = new TxManipulatorLineElementData(new TxTransformation(), new TxVector(0.0, 0.0, 0.0), new TxVector(0.0, this.MANIPULATOR_LENGTH, 0.0));
    ((TxManipulatorElementData) manipulatorLineElementData2).Color = new TxColor((byte) 0, byte.MaxValue, (byte) 0);
    ((TxManipulatorElementData) manipulatorLineElementData2).Pickable = true;
    ((TxManipulatorElementData) manipulatorLineElementData2).AlwaysOnTop = true;
    ((TxManipulatorElementData) manipulatorLineElementData2).Unzoomable = true;
    TxManipulatorLineElementData manipulatorLineElementData3 = new TxManipulatorLineElementData(new TxTransformation(), new TxVector(0.0, 0.0, 0.0), new TxVector(0.0, 0.0, this.MANIPULATOR_LENGTH));
    ((TxManipulatorElementData) manipulatorLineElementData3).Color = new TxColor(byte.MaxValue, byte.MaxValue, (byte) 0);
    ((TxManipulatorElementData) manipulatorLineElementData3).Pickable = true;
    ((TxManipulatorElementData) manipulatorLineElementData3).AlwaysOnTop = true;
    ((TxManipulatorElementData) manipulatorLineElementData3).Unzoomable = true;
    TxManipulatorArcElementData manipulatorArcElementData1 = new TxManipulatorArcElementData(new TxTransformation(new TxVector(0.0, -1.0 * Math.PI / 2.0, 0.0), (TxTransformation.TxRotationType) 1), this.MANIPULATOR_LENGTH, this.MANIPULATOR_LENGTH, 0.0, Math.PI / 2.0);
    ((TxManipulatorElementData) manipulatorArcElementData1).Color = TxColor.TxColorRed;
    ((TxManipulatorElementData) manipulatorArcElementData1).Pickable = true;
    ((TxManipulatorElementData) manipulatorArcElementData1).AlwaysOnTop = true;
    ((TxManipulatorElementData) manipulatorArcElementData1).Unzoomable = true;
    TxManipulatorArcElementData manipulatorArcElementData2 = new TxManipulatorArcElementData(new TxTransformation(new TxVector(Math.PI / 2.0, 0.0, 0.0), (TxTransformation.TxRotationType) 1), this.MANIPULATOR_LENGTH, this.MANIPULATOR_LENGTH, 0.0, Math.PI / 2.0);
    ((TxManipulatorElementData) manipulatorArcElementData2).Color = new TxColor((byte) 0, byte.MaxValue, (byte) 0);
    ((TxManipulatorElementData) manipulatorArcElementData2).Pickable = true;
    ((TxManipulatorElementData) manipulatorArcElementData2).AlwaysOnTop = true;
    ((TxManipulatorElementData) manipulatorArcElementData2).Unzoomable = true;
    TxManipulatorArcElementData manipulatorArcElementData3 = new TxManipulatorArcElementData(new TxTransformation(), this.MANIPULATOR_LENGTH, this.MANIPULATOR_LENGTH, 0.0, Math.PI / 2.0);
    ((TxManipulatorElementData) manipulatorArcElementData3).Color = new TxColor(byte.MaxValue, byte.MaxValue, (byte) 0);
    ((TxManipulatorElementData) manipulatorArcElementData3).Pickable = true;
    ((TxManipulatorElementData) manipulatorArcElementData3).AlwaysOnTop = true;
    ((TxManipulatorElementData) manipulatorArcElementData3).Unzoomable = true;
    TxManipulatorTextElementData manipulatorTextElementData1 = new TxManipulatorTextElementData(new TxTransformation(1.0, 0.0, 0.0, this.MANIPULATOR_LENGTH + this.TEXT_OFFSET_FROM_AXIS, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0), "X");
    ((TxManipulatorElementData) manipulatorTextElementData1).Color = TxColor.TxColorRed;
    ((TxManipulatorElementData) manipulatorTextElementData1).Pickable = true;
    ((TxManipulatorElementData) manipulatorTextElementData1).AlwaysOnTop = true;
    ((TxManipulatorElementData) manipulatorTextElementData1).Unzoomable = true;
    TxManipulatorTextElementData manipulatorTextElementData2 = new TxManipulatorTextElementData(new TxTransformation(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, this.MANIPULATOR_LENGTH + this.TEXT_OFFSET_FROM_AXIS, 1.0, 0.0, 0.0, 0.0), "Y");
    ((TxManipulatorElementData) manipulatorTextElementData2).Color = new TxColor((byte) 0, byte.MaxValue, (byte) 0);
    ((TxManipulatorElementData) manipulatorTextElementData2).Pickable = true;
    ((TxManipulatorElementData) manipulatorTextElementData2).AlwaysOnTop = true;
    ((TxManipulatorElementData) manipulatorTextElementData2).Unzoomable = true;
    TxManipulatorTextElementData manipulatorTextElementData3 = new TxManipulatorTextElementData(new TxTransformation(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, this.MANIPULATOR_LENGTH + this.TEXT_OFFSET_FROM_AXIS), "Z");
    ((TxManipulatorElementData) manipulatorTextElementData3).Color = new TxColor(byte.MaxValue, byte.MaxValue, (byte) 0);
    ((TxManipulatorElementData) manipulatorTextElementData3).Pickable = true;
    ((TxManipulatorElementData) manipulatorTextElementData3).AlwaysOnTop = true;
    ((TxManipulatorElementData) manipulatorTextElementData3).Unzoomable = true;
    this._data.InsertElementData((TxManipulatorElementData) manipulatorLineElementData1);
    this._data.InsertElementData((TxManipulatorElementData) manipulatorLineElementData2);
    this._data.InsertElementData((TxManipulatorElementData) manipulatorLineElementData3);
    this._data.InsertElementData((TxManipulatorElementData) manipulatorArcElementData1);
    this._data.InsertElementData((TxManipulatorElementData) manipulatorArcElementData2);
    this._data.InsertElementData((TxManipulatorElementData) manipulatorArcElementData3);
    this._data.InsertElementData((TxManipulatorElementData) manipulatorTextElementData1);
    this._data.InsertElementData((TxManipulatorElementData) manipulatorTextElementData2);
    this._data.InsertElementData((TxManipulatorElementData) manipulatorTextElementData3);
  }
}
